
#include <QtCore/QCoreApplication>
#include <boost/numeric/ublas/io.hpp>
#include <cstdlib>

#include "model.h"
#include "config.h"
#include "tests.h"

namespace ublas = boost::numeric::ublas;
using namespace mnshost;

int main(int argc, char *argv[])
{
	QCoreApplication a(argc, argv);

	FILELog::ReportingLevel() = logDEBUG;
	//Log::SetLogFile("mns.txt");
	FILE_LOG(logINFO) << "------------------------------------------";
	FILE_LOG(logINFO) << "MNS Test Started: " << GetDate();
	//FILE_LOG(logWARNING) << "w";
	//FILE_LOG(logERROR) << "e";

	Config cfg;
	std::string dbDriver = cfg.GetSetting("DBDriver");
	std::string dbSource = cfg.GetSetting("DBSource");
	int nTest = std::atoi(cfg.GetSetting("Test").c_str());
	mns::SetNofThreads(std::atoi(cfg.GetSetting("NofWorkerThreads").c_str()));
	
	FILE_LOG(logINFO) << "Test #: " << nTest;
	FILE_LOG(logINFO) << "N of Worker Threads: " << mns::GetNofThreads();
	switch (nTest)
	{
	case 1:
		{
			// Test of the Cholesky decomposition routine. Hilbert Matrix used.
			Test1(13);
		}
		break;
	case 2:
		{
			Test2();
		}
		break;
	case 3:
		{
			Test3();
		}
		break;
	default:
		break;
	}

	FILE_LOG(logINFO) << "MNS Test Completed.";
	qApp->exit();
	return 0; 
}
